using System;
using EPiServer.Common;
using EPiServer.Common.Security;

namespace EPiAbstractions.Common
{
    public class AuthorHandlerFacade : IAuthorHandlerFacade
    {
        private static AuthorHandlerFacade _instance;

        public static AuthorHandlerFacade Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new AuthorHandlerFacade();

                return _instance;
            }

            set { _instance = value; }
        }

        #region IAuthorHandlerFacade Members

        public virtual IAuthor AddAuthor(IAuthor author)
        {
            return AuthorHandler.AddAuthor(author);
        }

        public virtual void UpdateAuthor(IAuthor author)
        {
            AuthorHandler.UpdateAuthor(author);
        }

        public virtual void RemoveAuthor(IAuthor author)
        {
            AuthorHandler.RemoveAuthor(author);
        }

        public virtual IAuthor GetAuthor(Int32 id)
        {
            return AuthorHandler.GetAuthor(id);
        }

        public virtual IAuthor GetUserAuthor(IUser user)
        {
            return AuthorHandler.GetUserAuthor(user);
        }

        public virtual IAuthor GetAnonymousAuthor(IUser user, String pseudonym)
        {
            return AuthorHandler.GetAnonymousAuthor(user, pseudonym);
        }

        public virtual IAuthor ChangeAuthor(IAuthor author1, IAuthor author2)
        {
            return AuthorHandler.ChangeAuthor(author1, author2);
        }

        #endregion
    }
}